/* 
 * File:   DeliveryClient.hpp
 * Author: bd
 *
 * Created on April 2, 2011, 10:28 AM
 */

#ifndef DELIVERYCLIENT_HPP
#define	DELIVERYCLIENT_HPP
#include <string>
#include "ShortMsgItem.hpp"

class DeliveryClient {
public:
    typedef boost::shared_ptr<DeliveryClient> DeliveryClientPtr;

public:
    DeliveryClient(const std::string& connStr);
    virtual ~DeliveryClient();

    virtual void connect() = 0;
    virtual void send(const ShortMsgItem& smi) = 0;

    //Get-Set method
    void password(std::string password_);
    std::string password() const;
    void username(std::string username_);
    std::string username() const;
    void targetUrl(std::string targetUrl_);
    std::string targetUrl() const;
    void connected(bool connected_);
    bool connected() const;

protected:
    std::string targetUrl_;
    std::string username_;
    std::string password_;
    bool connected_;

};

void parse_connection_string(const std::string& connStr, std::map<std::string, std::string>& params);

class DeliveryClientFactory {
public:
    static DeliveryClient::DeliveryClientPtr create(const std::string& connStr);

protected:
private:
    DeliveryClientFactory();
    DeliveryClientFactory& operator=(const DeliveryClientFactory&);
};

#endif	/* DELIVERYCLIENT_HPP */
